package cn.kgc.springmvc.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;

/**
 * @author: mosin
 * @version: v1.0  2022/10/23
 */
@RestController
@RequestMapping("eCharts")
public class EChartsController {


    // 饼图
    @RequestMapping("bar")
    public  Object  bar(){

        HashMap<String, Object> map = new HashMap<>();
        ArrayList<String> xEle = new ArrayList<>();
        ArrayList<Integer> xData = new ArrayList<>();


        // 调用业务层查询数据  实现数据的封装
        Collections.addAll(xEle, "合肥","芜湖","蚌埠","阜阳");
        Collections.addAll(xData, 850,700,500,600);

        map.put("xEle", xEle);
        map.put("xData", xData);

        return  map;   // {"xEle":["合肥","芜湖"],"xData":[200,500] }
    }




}
